<%@page import="business.manage.dictionary.Dictionary"%>
<%@page import="common.database.bean.Page"%>
<%@page import="common.database.bean.CreatePageCode"%>
<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
	+ request.getServerName() + ":" + request.getServerPort()+ path + "/";
	String formUrl = path+"/dict/addDictionary";
	Dictionary dict = new Dictionary(); 
	Object object  = request.getAttribute("dict");
	if (object != null) {
		dict = (Dictionary)object;
		formUrl = path+"/dict/updateDictionary";
	}
	List<Dictionary> parentDictList = (List<Dictionary>)request.getAttribute("parentDictList");
	Object message = request.getAttribute("message");
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link rel="stylesheet" href="<%=path%>/inc/css.css" type="text/css" />
<link rel="stylesheet" href="<%=path%>/validate_js/validate.css" type="text/css" />
<script  src="<%=path%>/validate_js/talent-validate-all.js"  language="javascript"></script>
<script  src="<%=path%>/validate_js/talent-validate-all-init.js"  language="javascript"></script>
<script  src="<%=path%>/validate_js/jquery-1.6.4.js"  language="javascript"></script>
</head>
<body>
	
	<form name="operateForm" method="post" action="<%=formUrl %>" id="operateForm">
		<input type="hidden" name="id" value="<%=dict.getId() == null ? "" : dict.getId()%>">
		<table width="100%" border=0 align=center cellpadding=2 cellspacing=1
			bordercolor="#799AE1" class=tableBorder>
			<tbody>
				<tr>
					<th align=center colspan=16 style="height: 23px">数据项操作</th>
				</tr>
				
				<tr bgcolor="#DEE5FA">
					<td align="right" class="txlrow">&nbsp;父级</td>
					<td align=left class=txlrow>&nbsp; <select name="pid">
							<option value="0">-------</option>
							<%
								if(parentDictList.size()>0){
									for(int i=0;i<parentDictList.size();i++){
										Dictionary parent = parentDictList.get(i);
							%>

							<option value="<%=parent.getId() %>" <%if(parent.getId().equals(dict.getPid())){ %>selected<%} %>><%=parent.getName() %></option>
							<%
								}
									}
							%>
					</select>
					</td>
				</tr>
				<tr bgcolor="#DEE5FA">
					<td align="right" class="txlrow">&nbsp;编码</td>
					<td align="left" class=txlrow>&nbsp;<input type="text"
						name="code"
						value="<%=dict.getCode() == null ? "" : dict.getCode()%>"></td>
				</tr>
				<tr bgcolor="#DEE5FA">
					<td align="right" class="txlrow">&nbsp;名称</td>
					<td align=left class=txlrow>&nbsp;<input type="text"
						name="name"
						value="<%=dict.getName() == null ? "" : dict.getName() %>"></td>
				</tr>
				<tr bgcolor="#DEE5FA">
					<td align="right" class="txlrow">&nbsp;排序号</td>
					<td align=left class=txlrow>&nbsp;<input type="text"
						name="remarks"
						value="<%=dict.getRemarks() == null ? "" : dict.getRemarks()%>"></td>
				</tr>
				<tr bgcolor="#DEE5FA">
					<td colspan="2" align="center" class="txlrow">
						<input type = "button" name="operateDict" value="提交" onclick="submitDict()">
						&nbsp;&nbsp;&nbsp;&nbsp;
						<input type = "button" name="clear" value="清除">
					</td>
				</tr>	
				<tr bgcolor="#DEE5FA">
					<td colspan="2" align="center" class="txlrow">
						<%if(message!=null){
							out.println(message);
						%>
						<script language="javascript">
							window.parent.frames["phoneLeftFrame"].location.reload();  
						</script>
						<%} %>
					</td>
				</tr>		
			</tbody>
		</table>
	</FORM>
	<script language="javascript">
		tt.vf.req.add("code","name","remarks"); 
		tt.num.req.add("remarks"); 
		function submitDict(){
			if(tt.validate()==false){
				return;
			}
			var operateForm = document.getElementById("operateForm");
			operateForm.submit();
			
		}
	</script>

</BODY>
</HTML>